Radical militants moved closer toward Baghdad, seizing key cities and confronting President Obama with a fresh foreign-policy crisis.